#ifndef CLIONQT5WORK_MAINWINDOW_H
#define CLIONQT5WORK_MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
#include <QPixmap>
#include <QImage>
#include <QPushButton>
#include <QMenuBar>
#include <QFileDialog>
#include <QSplitter>
#include <QVBoxLayout>
#include "imagelabel.h"

#include <opencv2/opencv.hpp>

class MainWindow : public QMainWindow {
Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void loadImage1();
    void loadImage2();
    void updateDisplay();
    void handleRegionSelected(QRect rect); // 左图框选完回调

private:
    ImageLabel* leftLabel;
    ImageLabel* rightLabel;

    cv::Mat img1, img2, img2_aligned;
    QImage cvMatToQImage(const cv::Mat& mat);
    void registerImage();

    cv::Mat homography;
    float scale1 = 1.0f, scale2 = 1.0f;

    void drawMappedRectOnRight(const QRect& leftRect);  // 添加这一行

};
#endif //CLIONQT5WORK_MAINWINDOW_H
